package com.woniuxy.util;

import org.springframework.stereotype.Component;

@Component
public class MyRedisKeyUtil {
    //缓存里的key要具有可识别度，唯一性，规范
    //小写字母，英文.英文:，数字，不能包含特殊字符，下划线
    public String registerCodeKey(String phone){return "register:phone:"+phone;}
    public String loginCodeKey(String phone){
        return "login:phone:"+phone;
    }
    public String sendRegisterInMinute(String phone){
        return "register:phone:inminute:"+phone;
    }
    public String sendLoginInMinute(String phone){
        return "login:phone:inminute:"+phone;
    }
    public String sendCodeTotalInHour(String phone){
        return "code:total:"+phone;
    }
    public String errorTotal(String phone){
        return "error:total:"+phone;
    }
    public  String collectBookList(Integer userId){
        return "collectBookList:userid:"+userId;
    }
    public String collectBookRank(){return "collectBookRank:number";}
    public String shoppingCarKey(Integer userId){return "shoppingCar:userid:"+userId;}
    public String shoppingCarInfoKey(Integer userId,Integer bookId) {return "shoppingCarInfo:userid:"+userId+":bookid:"+bookId;}
    public String bookTypeTree(){return "bookTypeTree";}
    public String lockObjectKey(String name,Object keyValue){return "lock:"+name+":"+keyValue;}
}
